<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Aspect Ratio Example</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f4f4f4;
        }

        .container {
            max-width: 960px;
            margin: 0 auto;
        }

        h1 {
            text-align: center;
            color: #333;
        }

        .video-container {
            width: 100%;
            aspect-ratio: 16 / 9;
            background-color: #000;
            margin-bottom: 20px;
        }

        .video-container iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        .image-container {
            width: 100%;
            aspect-ratio: 4 / 3;
            background-color: #ddd;
            background-image: url('https://via.placeholder.com/800x600');
             /* 被用作占位符图片 */
            background-size: cover;
            background-position: center;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>Aspect Ratio Example</h1>

        <!-- 视频容器，保持16:9的宽高比 -->
        <div class="video-container">
            <iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ" allowfullscreen></iframe>
        </div>

        <!-- 图片容器，保持4:3的宽高比 -->
        <div class="image-container"></div>
    </div>
</body>

</html>